﻿using System;
using Excel = Microsoft.Office.Interop.Excel;

namespace QAToolsAddin {
    public class ConnectBase : Object, Extensibility.IDTExtensibility2 {
        protected Excel.Application _excelapp;
        protected object _addInInstance;
        protected Commands _commands;

        public void Test() {

        }

        void Extensibility.IDTExtensibility2.OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref Array custom) {
            if (application is Excel.Application) {
                _excelapp = (Excel.Application)application;
                _addInInstance = addInInst;
                _commands = new Commands((Excel.Application)application);
                if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
                    OnStartupComplete();
            }
        }

        public virtual void OnStartupComplete() {

        }

        void Extensibility.IDTExtensibility2.OnStartupComplete(ref Array custom) {
            OnStartupComplete();
        }

        void Extensibility.IDTExtensibility2.OnAddInsUpdate(ref Array custom) {

        }

        void Extensibility.IDTExtensibility2.OnBeginShutdown(ref Array custom) {

        }

        void Extensibility.IDTExtensibility2.OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom) {

        }
    }
}
